package com.crm.utils;

import com.crm.model.system.pojo.User;

public class ThreadLocalUtil {

private final static ThreadLocal<User> USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
    * 添加用户
    */
    public static void setUser(User user) {
        USER_THREAD_LOCAL.set(user);
    }

    /**
     * 获取用户
     */
    public static User getUser() {
        return USER_THREAD_LOCAL.get();
    }

    /**
    * 移除用户
    */
    public static void removeCurrentId() {
        USER_THREAD_LOCAL.remove();
    }

    /**
     * 清理用户
     */
    public static void clear(){
        USER_THREAD_LOCAL.remove();
    }
}